<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Example: Using Grid Units</title>
    <link rel="stylesheet" href="http://yui.yahooapis.com/3.4.0pr3/build/cssgrids/grids-min.css">
    <link rel="stylesheet" href="../assets/css/main.css">
    <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
    <script src="../../build/yui/yui-min.js"></script>
</head>
<body>

<div id="doc">
    <h1>Example: Using Grid Units</h1>

    

    <div class="yui3-g">
        <div id="main" class="yui3-u">
            <div class="content"><div class="intro">
    <p>Creating a layout using grids requires a <code>yui3-g</code> container and any number of <code>yui3-u-*</code> units.  To create a layout that splits the units 50/50, use <code>yui3-u-1-2</code> units.</p>

</div>

<div class="example newwindow">
    <a href="cssgrids-units-example.html" target="_blank" class="button">
        View Example in New Window
    </a>
</div>

<h4>Note</h4>
<p>The only child elements (e.g. direct descendants) of a <code>yui3-g</code> should be <code>yui-3-u-*</code> elements. Any elements within a <code>yui3-g</code> need to be wrapped in a <code>yui3-u-*</code> of some kind, otherwise you may experience side-effects due to the layout system being used.</p>
<h3>Basic Markup Structure</h3>

<pre class="code prettyprint">&lt;div class=&quot;yui3-g&quot;&gt;
    &lt;div class=&quot;yui3-u-1-2&quot;&gt;&lt;&#x2F;div&gt;
    &lt;div class=&quot;yui3-u-1-2&quot;&gt;&lt;&#x2F;div&gt;
&lt;&#x2F;div&gt;</pre>


<h3>Provide a Content Container</h3>
<p>Styling should be applied to a container within the unit, rather than the unit itself.  This allows you to set borders, padding, margins (gutters), etc. without worrying about breaking the layout.  For this demo we will give the content a class of <code>content</code>, but can be called whatever you like.</p>

<pre class="code prettyprint">&lt;div class=&quot;yui3-g&quot;&gt;
    &lt;div class=&quot;yui3-u-1-2&quot;&gt;
        &lt;div class=&quot;content&quot;&gt;

        &lt;&#x2F;div&gt;
    &lt;&#x2F;div&gt;
    &lt;div class=&quot;yui3-u-1-2&quot;&gt;
        &lt;div class=&quot;content&quot;&gt;

        &lt;&#x2F;div&gt;
    &lt;&#x2F;div&gt;
&lt;&#x2F;div&gt;</pre>


<h3>Adding a Gutter</h3>
<p>All units align edge to edge, with zero space in between.  You can add space ("gutter"), by simply adding a margin to your content.  This is where additional content styling, such as borders, padding, colors, etc. can be applied as well.</p>

<pre class="code prettyprint">&lt;style&gt;
.yui3-g .content {
    border: 2px solid #000;
    margin-right:10px; &#x2F;* &quot;column&quot; gutters *&#x2F;
    padding: 1em;
}
&lt;&#x2F;style&gt;</pre>


<h3>Available Units</h3>

<table class="auto">
	<thead>
		<tr class="odd">
			<th>Class</th>
			<th>Description</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td><code>.yui3-u</code></td>
			<td>shrinks to fit content (unless given an explicit size)</td>
		</tr>
		<tr class="odd">
			<td><code>.yui3-u-1</code></td>
			<td>fills entire width of container</td>
		</tr>
		<tr>
			<td><code>.yui3-u-1-2</code></td>
			<td>fills 1/2 the container</td>
		</tr>
		<tr class="odd">
			<td><code>.yui3-u-1-3</code></td>
			<td>fills 1/3 the container</td>
		</tr>
		<tr>
			<td><code>.yui3-u-2-3</code></td>
			<td>fills 2/3 the container</td>
		</tr>
		<tr class="odd">
			<td><code>.yui3-u-1-4</code></td>
			<td>fills 1/4 the container</td>
		</tr>
		<tr>
			<td><code>.yui3-u-3-4</code></td>
			<td>fills 3/4 the container</td>
		</tr>
		<tr class="odd">
			<td><code>.yui3-u-1-5</code></td>
			<td>fills 1/5 the container</td>
		</tr>
		<tr>
			<td><code>.yui3-u-2-5</code></td>
			<td>fills 2/5 the container</td>
		</tr>
		<tr class="odd">
			<td><code>.yui3-u-3-5</code></td>
			<td>fills 3/5 the container</td>
		</tr>
		<tr>
			<td><code>.yui3-u-4-5</code></td>
			<td>fills 4/5 the container</td>
		</tr>
		<tr class="odd">
			<td><code>.yui3-u-1-6</code></td>
			<td>fills 1/6 the container</td>
		</tr>
		<tr>
			<td><code>.yui3-u-5-6</code></td>
			<td>fills 5/6 the container</td>
		</tr>
	</tbody>
</table>
</div>
        </div>

        <div id="sidebar" class="yui3-u">
            

            
                <div class="sidebox">
                    <div class="hd">
                        <h2 class="no-toc">Examples</h2>
                    </div>

                    <div class="bd">
                        <ul class="examples">
                            
                                
                                    <li data-description="Each unit has a className that provides its percentage width.">
                                        <a href="cssgrids-units.html">Using Grid Units</a>
                                    </li>
                                
                            
                                
                                    <li data-description="This is a template for creating fixed-width layouts.">
                                        <a href="cssgrids-fixed.html">Fixed Page Template</a>
                                    </li>
                                
                            
                                
                                    <li data-description="This is a template for creating fluid layouts.">
                                        <a href="cssgrids-fluid.html">Fluid Page Template</a>
                                    </li>
                                
                            
                                
                                    <li data-description="Basic CSS properties are leveraged to horizontally and vertically align units.">
                                        <a href="cssgrids-align.html">Aligning Grid Units</a>
                                    </li>
                                
                            
                                
                            
                                
                            
                                
                            
                                
                            
                                
                            
                                
                            
                                
                            
                        </ul>
                    </div>
                </div>
            

            
                <div class="sidebox">
                    <div class="hd">
                        <h2 class="no-toc">Examples That Use This Component</h2>
                    </div>

                    <div class="bd">
                        <ul class="examples">
                            
                                
                            
                                
                            
                                
                            
                                
                            
                                
                                    <li data-description="Creating left navigation using the MenuNav Node Plugin.">
                                        <a href="../node-menunav/menunav-leftnav.html">Basic Left Nav</a>
                                    </li>
                                
                            
                                
                                    <li data-description="Creating top navigation using the MenuNav Node Plugin">
                                        <a href="../node-menunav/node-menunav-2.html">Basic Top Nav</a>
                                    </li>
                                
                            
                                
                                    <li data-description="Creating menu button navigation using the MenuNav Node Plugin">
                                        <a href="../node-menunav/node-menunav-3.html">Menu Button Top Nav</a>
                                    </li>
                                
                            
                                
                                    <li data-description="Creating split button navigation using the MenuNav Node Plugin">
                                        <a href="../node-menunav/node-menunav-4.html">Split Button Top Nav</a>
                                    </li>
                                
                            
                                
                                    <li data-description="Adding shadows to submenus of a left nav using the MenuNav Node Plugin">
                                        <a href="../node-menunav/node-menunav-5.html">Left Nav with Submenus with Shadows</a>
                                    </li>
                                
                            
                                
                                    <li data-description="Adding rounded corners to submenus of a left nav using the MenuNav Node Plugin">
                                        <a href="../node-menunav/node-menunav-6.html">Left Nav With Submenus With Rounded Corners</a>
                                    </li>
                                
                            
                                
                                    <li data-description="Skining a menu built using the MenuNav Node Plugin to look like the menus on Flickr">
                                        <a href="../node-menunav/node-menunav-7.html">Skinning Menus Created Using the MenuNav Node Plugin</a>
                                    </li>
                                
                            
                        </ul>
                    </div>
                </div>
            
        </div>
    </div>
</div>

<script src="../assets/vendor/prettify/prettify-min.js"></script>
<script>prettyPrint();</script>

</body>
</html>
